﻿<%@ Page Language="C#" MasterPageFile="~/member/mMenber.master" AutoEventWireup="true"
    CodeBehind="area5.aspx.cs" Inherits="map.manage.area5" Title="标注地标/小区位置" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head2" runat="server">
    <link href="../outstyle.css" rel="stylesheet" type="text/css" />
    <link href="../Stylesheet1.css" rel="stylesheet" type="text/css" />

    <script src="../js/dropdowncontent.js" type="text/javascript"></script>

    <script src="../js/CBScript.js" type="text/javascript"></script>

    <script src="../js/mapiconmaker_packed.js" type="text/javascript"></script>
    </script>

    <style type="text/css">
        .style6
        {
            width: 450px;
        }
        .style7
        {
            width: 72px;
            text-align:center;
        }
    </style>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
<asp:Literal ID="Literal_map" runat="server"></asp:Literal>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            县:<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
            </asp:DropDownList>
            地区:<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged">
            </asp:DropDownList>
            区域:<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList3_SelectedIndexChanged">
            </asp:DropDownList>
            <br />
            <hr />
            <br />
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="590px"
                DataKeyNames="RECID" CellPadding="4" ForeColor="#333333" GridLines="None" OnRowDeleting="GridView1_RowDeleting"
                OnSelectedIndexChanging="GridView1_SelectedIndexChanging" BorderWidth="1px">
                <RowStyle BackColor="#EFF3FB" />
                <Columns>
                    <asp:BoundField DataField="RECID" HeaderText="RECID" Visible="False" />
                    <asp:BoundField DataField="BizAreaName" HeaderText="地标名称">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="taobaolong" HeaderText="经度">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="taobaolat" HeaderText="纬度">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:CommandField ShowSelectButton="True" />
                     <asp:CommandField ShowDeleteButton="True" />
                </Columns>
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <EmptyDataTemplate>
                    当前区内没有区域数据,请在下方增加区域.
                </EmptyDataTemplate>
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#2461BF" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
            <table class="style6">
            <tr>
            <td class="style7">
                        &nbsp;地标名称:</td>
            <td>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="必须填写项目。"
                ControlToValidate="TextBox1"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td class="style7">
                        &nbsp;经度:</td>
                    <td>
                       <asp:TextBox ID="TextBox_long" runat="server" Enabled="False"></asp:TextBox><span
                class="style5">&nbsp;*</span>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="在地图上标记。"
                ControlToValidate="TextBox_long"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td class="style7">
                        &nbsp;纬度:</td>
                    <td>
                       <asp:TextBox ID="TextBox_lat" runat="server" Enabled="False"></asp:TextBox><span
                class="style5">&nbsp;*</span>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="在地图上标记。"
                ControlToValidate="TextBox_long"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td class="style7">
                        &nbsp;简单介绍</td>
                    <td>
                        <asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr><td class="style7">所有者:</td>
                <td><asp:TextBox ID="owner" runat="server" Enabled="False"></asp:TextBox><span
                class="style5">&nbsp;*</span><asp:Label id="showError" runat="server"></asp:Label></td></tr>
            </table>
          <%--  当前记录ID:--%>
            <asp:Label ID="Label_recid" runat="server" Text="RECID" Visible="False"></asp:Label><br />
            
           
            <br />
            &nbsp; 
            <br />
            &nbsp; <br />
                
            <asp:Button ID="Button1" runat="server" Text="增加" OnClick="Button1_Click" />
            <asp:Button ID="Button2" runat="server" Text="修改" OnClick="Button2_Click" /><br />
        </ContentTemplate>
    </asp:UpdatePanel>

    <script type="text/javascript">
         var map;
         var geocoder = null;
         function markpos2(zlong, zlat, desc) {
             map.clearOverlays();            
             var point1 = new GLatLng(zlat, zlong);
             var marker1 = new GMarker(point1);

             GEvent.addListener(marker1, "click", function() {
                 marker1.openInfoWindowHtml("标注此位置");
             });
             map.addOverlay(marker1);
             map.setCenter(point1, 14);

         }
         function showAddress(address) {
             if (geocoder) {
                 geocoder.getLatLng(
          address,
          function(point) {
              if (!point) {
                  alert("不能解析: " + address);
              } else {
                  map.setCenter(point, 13);
                  var marker = new GMarker(point);
                  map.addOverlay(marker);
                  marker.openInfoWindowHtml(address);
              }
          }
        );
             }
         }
         function markpos(zlong, zlat, desc) {
             if (GBrowserIsCompatible()) {
                 var mapOptions = {
                     googleBarOptions: {
                         style: "new"
                     }
                 }


                 map = new GMap2(document.getElementById("map_canvas"), mapOptions);


                 map.setMapType(G_NORMAL_MAP);
                 map.addControl(new GMapTypeControl());
                 map.addControl(new GLargeMapControl());
                 map.enableContinuousZoom();
                 map.addControl(new GOverviewMapControl());
                 geocoder = new GClientGeocoder();

                 map.enableGoogleBar();



                 var center = new GLatLng(zlat, zlong);
                 map.setCenter(center, 14);



                 GEvent.addListener(map, "click", function(overlay, latlng) {
                     if (latlng) {
                         var myHtml = "标注此位置";
                         //m.removeOverlay(marker);
                         map.clearOverlays();

                         map.openInfoWindow(latlng, myHtml);
                         var lat = latlng.lat();
                         var lon = latlng.lng();
                         //map.clearOverlays();
                         //                        var ss1 = document.getElementById("ctl00_ContentPlaceHolder1_Label5");
                         //                        var ss2 = document.getElementById("ctl00_ContentPlaceHolder1_Label3");
                         //                        document.getElementById("ctl00_ContentPlaceHolder1_Label5").value = lat;
                         //                        document.getElementById("ctl00_ContentPlaceHolder1_Label3").value = lon;
                      

                         document.getElementById("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder3_TextBox_lat").value = lat;
                         document.getElementById("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder3_TextBox_long").value = lon;
                         var point = new GLatLng(lat, lon);
                         var marker = new GMarker(point);
                         GEvent.addListener(marker, "click", function() {
                             marker.openInfoWindowHtml("标注此位置");
                         });
                         map.addOverlay(marker);
                     }
                 });
                 //                var point1 = new GLatLng(zlat, zlong);
                 //                var marker1 = new GMarker(point1);
                 //                GEvent.addListener(marker1, "click", function() {
                 //                    marker1.openInfoWindowHtml("标注此位置");
                 //                });
                 //                map.addOverlay(marker1);
             }
         }
    </script>

    单击地图的图标,标注位置:<br />
    <div id="map_canvas" style="width: 100%; height: 360px;">
    </div>
</asp:Content>
